home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Apple WWDC 1996
/
WWDC96_1996 (CD).toast
/
Technology Materials
/
MacOS 8 Resources
/
Developer Tools
/
MPW Additions
/
ModPEF Notes
< prev
next >
Wrap
Text File
|
1996-05-07
|
13KB
|
373 lines
ModPEF Notes for "Mac OS 8 Resources"
ModPEF 1.0d5 Released for WWDC, May 1996
Copyright: © 1994-1996 by Apple Computer, Inc.
All rights reserved.
#########################################################################
** NOTE: This is an engineering build and has not been fully tested ***
#########################################################################
ModPEF
A utility for PEF fragments
============
What it does
============
ModPEF copies fragments from an existing PEF file to a new PEF file, optionally
editing fragment attributes as they are copied. ModPEF does not touch the resource
fork except for reading/writing the 'cfrg' resource and copying 'rseg' and 'CODE'
resources for CFM-68K PEF containers.
====================
Command line options
====================
ModPEF [option...] file... >= progress
-@addexports <fragspec> = <filename> # Add exported symbols to fragment
# <filename> contains names of symbols
-@alias <fragspec> = <filename> # Allow aliases to exported symbol names
-c creator # Set file creator
-delete <fragspec> , ... # Delete fragments from file
-deleteexports <fragspec> = <aName> , ... # Delete exported symbols from fragment
-@deleteexports <fragspec> = <filename> # Delete exported symbols from fragment
# <filename> contains names of symbols
-describe on | off # Describe which fragments are affected
# (Default is on)
-extract <fragspec> , ... # Extract fragments from file
-[no]initbefore <fragspec> = <aName> , ... # Modify fragment's "initbefore" settings
-level <fragspec> = <aLevel> # Change how fragment is used
-list # List contents of file
-mergecode on | off # Make code sections adjacent (default is off)
-o <filename> # Set output file name
-p # Write progress information to diagnostics
-renamefrag <fragspec> = <aName> # Rename a fragment
-@renamesymbols <fragspec> = <filename> # Rename fragment's imported/exported symbols
-share <fragspec> = context | global | protected | <aNumber>
# Change fragment's data section sharing attribute
-stacksize <fragspec> = <aNumber> # Set fragment's stack size
-t type # Set file type
-usage <fragspec> = library | application | dropin | <aNumber>
# Change fragment's usage type
-v # Use verbose progress (implies -p)
-vercur <fragspec> = <aNumber> # Change fragment's current version
-verdef <fragspec> = <aNumber> # Change fragment's definition version
-verimp <fragspec> = <aNumber> # Change fragment's implementation version
-[no]weak <fragspec> = <aName> , ... # Modify fragment's weak imports
-[no]weaklib <fragspec> = <aName> , ... # Modify fragment's weak libraries
<fragspec> ::= <aName>[ '(' <fraginfo> , ... ')' ]
<fraginfo> ::= <anArch> # Which architecture
arch = <anArch> #
arch = <aNumber> #
<aLevel> # Base library or update library
level = <aLevel> #
level = <aNumber> #
vercur = <aNumber> # Current version
verdef = <aNumber> # Definition version
<aName> ::= characters other than "," "(", ")" and "="
"*" # Wild card: match any fragment name
<aNumber> ::= <decimal> | $<hex> | 0x<hex>
<anArch> ::= pwpc | m68k
<aLevel> ::= base | update
==============
Some Scenarios
==============
To extract fragments
--------------------
ModPEF -extract 'InterfaceLib(vercur=12)' [partial]
-extract 'CPlusLib' [partial]
-extract 'QuickTimeLib(verdef=3)' [partial]
oldLibrary [partial]
-o fragLibrary
All fragments named 'CPlusLib" are extracted, all 'InterfaceLib' fragments
whose current version number is 12 and all 'QuickTimeLib' fragments whose
definition version number is 3 are copied from "oldLibrary" and written
to "fragLibrary". "oldLibrary" is not modified.
To delete fragments
--------------------
ModPEF -o newLibrary [partial]
oldLibrary [partial]
-delete 'InterfaceLib(vercur=12)' [partial]
-delete 'CPlusLib(pwpc)' [partial]
-delete 'QuickTimeLib(verdef=3)'
The specified fragments are deleted when "oldLibrary" is copied to "newLibrary".
"oldLibrary" is not modified.
To change the stacksize for an application
------------------------------------------
ModPEF myNiftyApp [partial]
-stacksize myNiftyApp=$20000 [partial]
-o myNiftyApp.new
The stacksize required by "myNiftyApp" is changed to $20000 bytes. The
changed file is written to "myNiftyApp.new". "myNiftyApp" is not
modified.
======================
Description of options
======================
Listing fragments
-----------------
ModPEF <file> -list
An input file is required.
Writes the names of the fragments specified in the 'cfrg'(0) resource of
the file.
Deleting fragments
------------------
ModPEF <old> -o <new> -delete <fragspec>
An input file and output file are required.
Each <fragspec> must be preceded by the "-delete" option.
All fragments from <old> are copied to <new> except for those named by
the <fragspecs>.
Extracting fragments
--------------------
ModPEF <old> -o <new> -extract <fragspec>
An input file and output file are required.
Each <fragspec> must be preceded by the "-extract" option.
All fragments from <old> matching the <fragspec>s are copied to <new>.
Changing fragment attributes
----------------------------
ModPEF <old> -o <new>
[-delete <fragspec>]
[-extract <fragspec>]
-level <fragspec> = <aLevel>
-[no]initbefore <fragspec> = <aName> , ...
[-mergecode on | off]
-rename <fragspec> = <aName>
-share <fragspec> = context | global | protected | <aNumber>
-stacksize <fragspec> = <aNumber>
-usage <fragspec> = library | application | dropin
-vercur <fragspec> = <aNumber>
-verdef <fragspec> = <aNumber>
-verimp <fragspec> = <aNumber>
-[no]weak <fragspec> = <aName> , ...
-[no]weaklib <fragspec> = <aName> , ...
An input file and output file are required.
The -delete and -extract are optional. If -delete is present, all fragments
except those marked for deletion are copied and/or modified. If -extract is
present, only those fragments marked for extraction are copied and/or modified.
Combining both -delete and -extract is incorrect.
Fragments from <old> are copied to <new>. Those fragments matching the
<fragspec>s are modified according to the <options> associated with the
<fragspec>. If a single fragment is matched by several options, the
changes are done in order of command line appearance. Renaming or
changing version numbers does not affect matching: the matching is done
prior to any renaming/reversioning.
To add export symbols to a fragment
-----------------------------------
ModPEF <old> -o <new> -@addexports <fragspec>=<filename>
The symbols contained in the file <filename> are added to the exported
symbols section of the <fragspec> fragment. The new file is written
to <new>.
Format of the lines in the -@addexports file is
<name> <section>[:]<offset> [<class>]
<name> is anything without embedded blanks or tabs.
<section> is a number or one of the following names:
code
data
none (becomes section -1)
absolute (becomes section -2)
transfer (becomes section -3)
<offset> is a numeric offset into the section.
The optional <class> (default is "data") is a number
or one of the following class names:
code
data
tvector
tocentry
glue
The line can also be a blank line or a comment line,
where comment lines begin with a "#" or "*" character
and extend to the end of the line.
For example, to add two symbols defining the start of the code and
data sections, the file could contain these lines:
*
# This file defines two exported symbols for the start of the
# code and data sections
*
startOfCode code:0 code
startOfData data 0 data
To rename imported/exported symbols
-----------------------------------
ModPEF <old> -o <new> -@renamesymbols <fragspec>=<filename>
The file <filename> contains lines of pairs of symbols: <oldName> <newName>.
Each occurrence of an <oldName> as a symbol in an import library or export
list in the specified fragment is replaced with <newName>. The new file is
written to <new>.
Format of the lines in the -@renamesymbols file is
<oldName> <newName>
The <...name> is anything without embedded blanks or tabs.
The line can also be a blank line or a comment line,
where comment lines begin with a "#" or "*" character
and extend to the end of the line.
To assign aliases to exported symbols
-------------------------------------
ModPEF <old> -o <new> -@alias <fragspec>=<filename>
The file <filename> contains lines of pairs of symbols: <oldName> <newName>.
Each occurrence of an <oldName> as a symbol in an export list in the specified
fragment is given the alias <newName>. The new file is written to <new>.
Format of the lines in the -@alias file is
<oldName> <newName>
The <...name> is anything without embedded blanks or tabs.
The line can also be a blank line or a comment line,
where comment lines begin with a "#" or "*" character
and extend to the end of the line.
For example, to add aliases for two symbols, the file could contain these lines:
*
# This file adds aliases for two symbols
*
MyPublic MyPublic_3r
Version Version_3r
To delete exported symbols
--------------------------
ModPEF <old> -o <new> -@deleteexports <fragspec>=<filename>
ModPEF <old> -o <new> -deleteexports <fragspec>=<aName>,...
The file <filename> contains symbols, one per line. Each symbol so named
is deleted from the export section of the fragment. The new file is written
to <new>.
Format of the lines in the -@deleteexports file is
<exportedName>
The <...name> is anything without embedded blanks or tabs.
The line can also be a blank line or a comment line,
where comment lines begin with a "#" or "*" character
and extend to the end of the line.
Decreasing runtime memory footprint
-----------------------------------
ModPEF <old> -o <new> -mergecode on | off
-mergecode on will create overlapping fragments in the output file. The
code sections of each container will be made physically adjacent. This
merging can improve paging behavior when fragments are loaded from the
library. When no merging is done, one code page from a container's code
section will contain non-code such as the pieces of the piData or loader
section. That non-code is wasted once the fragment has been initialized.
By overlapping fragments and making code sections physically adjacent, the
non-code from one fragment's code section will be the code from another
fragment's code section. Although we cannot guarantee that the other code
will be used and decrease overall memory footprint, we at least increase
the probability of improving paging behavior.
Controlling descriptions
------------------------
ModPEF -describe on | off
By default "on", ModPEF describes which resources are affected by the
-extract, -delete and -merge operations.
==============
The fine print
==============
1. Input files are never modified.
2. Only one CFM-68K application is allowed per file.
Because of the 'RSEG'(0) and 'RSEG'(1) resources, only one 680x0 application
can appear in a file. Attempts to add more than one CFM-68K application will
generate an error message.
3. The -mergecode option has no effect on CFM-68K applications.
Because the 680x0 code is stored in the resource fork, no merging of code is
possible.
4. Import library names and versions can go stale.
ModPEF does not touch the import libraries part of the loader section. If a
fragment has its version numbers modified, any references to it in the import
libraries section of other fragments will not be changed. You have been warned.
5. The -describe option defaults to "on".
Because a file can contain multiple versions of a fragment for different
architectures and with different version numbers, the default behavior is to
describe which fragments are being affected by ModPEF.